home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
pctj8406.arc
/
SIMPLE.PRG
< prev
next >
Wrap
Text File
|
1986-09-14
|
4KB
|
106 lines
SET TALK OFF
ERASE
STORE f TO terminate
* - controls repetition of the entire program
DO WHILE (.not. terminate)
*(
*( The bulk of the program would
*( go here, within the major loop
*( controlled by the logical
*( memvar "terminate" - the validation
*( loop appears below
*(
**********************************************
* - VALIDATION LOOP
* - obtain a valid Yes or No answer
* - create the memvars "answer" and "answered"
STORE "Y" TO answer
STORE f TO answered
* - clear the screen
ERASE
* - ask until a proper answer is given
DO WHILE .not. answered
* - ask the question...
@ 10,5 SAY "Do you wish to continue? (Y/N)"
* - get the answer, forcing it to upper case
@ $,$+2 GET answer PICTURE "!"
READ
* - deactivate the GET field
CLEAR GETS
* - erase any previous error messages
@ 10,0
@ 11,0
* - test the answer, respond appropriately
DO CASE
* - if the answer is NO:
CASE answer = "N"
* - we have a valid answer, and
STORE t TO answered
* - the answer means we should terminate
STORE t TO terminate
ERASE
* - we show that we are terminating
@ 10,10 SAY "Terminating, please stand by."
* - if the answer is YES:
CASE answer = "Y"
* - we have a valid answer, and
STORE t TO answered
* - the answer means we don't terminate
STORE f TO terminate
* - we indicate that answer has been accepted
@ 11,10 SAY "Continuing."
* - the answer was something else (anything)
OTHERWISE
* - we don't yet have a good answer
STORE f TO answered
* - we ask for a better answer
@ 11,10 SAY "Please answer Yes or No....."
ENDCASE
* - try again if "answered" is still false
ENDDO - while not answered
* - release the loop variables
RELEASE answer, answered
ERASE
ENDDO - while not terminate
RELEASE terminate
* - terminate the program
QUIT
***